<?php
/**
 * *
 *  * ============================================================================
 *  * Created by PhpStorm.
 *  * User: Ice
 *  * 邮箱: ice@sbing.vip
 *  * 网址: https://sbing.vip
 *  * Date: 2019/9/20 下午5:19
 *  * ============================================================================.
 */

namespace app\common\service\landlord;

use think\Service;
use app\common\service\RedisMake;
use app\common\service\Socket;

/**
 * 斗地主
 */
class Index extends Service
{
    protected $gameName = "landlord";
    public function index($data,$fd,$default_action = "")
    {
        $action = $data['action']??$default_action;
        $result = swoole_error("系统错误！");
        switch($action){
            case "connect":
                $connect = new Connect($this->app);
                $result = $connect->connect($data['data']??[],$fd);
                break;
            case "close":
                $connect = new Connect($this->app);
                $result = $connect->close($data['roomNumber']??"",$fd);
                break;
            case "ready":
                $connect = new Connect($this->app);
                $result = $connect->ready($data['data']??[],$fd);
                break;
            default:
                break;
        }
        return $result;
    }

}
